var Mask = function () {
	this.zIndexNow = 100;
	this.maskDiv = null;
	this.theme = "/css/Mask.css";
	this.indexArr = [];
	this.show = function () {
	    
	    if( $("maskCss") == null )
	    {
	        OnStylesheetInit(this.theme, "maskCss");
	    }
	    
		this.zIndexNow += 10;
		if (this.indexArr.length == 0){
			var maskHeight = document.documentElement.scrollHeight > getWindowSize()[1] ? document.documentElement.scrollHeight : getWindowSize()[1];
			this.maskDiv = createElement("div");
			this.maskDiv.onclick = function () {
				var event = arguments[0] || window.event;
				event.cancelBubble = true;
			};
			this.maskDiv.className = "mask";
			this.maskDiv.style.width = document.documentElement.scrollWidth + "px";
			this.maskDiv.style.height = maskHeight + "px";
			document.body.appendChild(this.maskDiv);
		}
		this.maskDiv.style.zIndex = this.zIndexNow - 1;
		this.indexArr.push(this.zIndexNow - 1);
		hideSelects(this.zIndexNow);
	};
	this.clean = function () {
		showSelects(this.zIndexNow);
		this.indexArr.pop();
		if (this.indexArr.length > 0){
			this.maskDiv.style.zIndex = this.indexArr[this.indexArr.length - 1];
			this.zIndexNow = this.indexArr[this.indexArr.length - 1] + 1;
		}
		else {
			document.body.removeChild(this.maskDiv);
			this.zIndexNow = 100;
		}
	};
	this.booleanLoading = false;
	this.showLoading = function () {
		this.booleanLoading = true;
		this.zIndexNow += 10;
		if (this.indexArr.length == 0){
			var maskHeight = document.documentElement.scrollHeight > getWindowSize()[1] ? document.documentElement.scrollHeight : getWindowSize()[1];
			this.maskDiv = createElement("div");
			this.maskDiv.className = "loading";
			this.maskDiv.style.backgroundPositionY = (getWindowSize()[1] - 73) / 2 + document.documentElement.scrollTop + "px";
			this.maskDiv.style.width = "100%";
			this.maskDiv.style.height = maskHeight + "px";
			document.body.appendChild(this.maskDiv);
		}
		this.maskDiv.style.zIndex = this.zIndexNow - 1;
		this.indexArr.push(this.zIndexNow - 1);
		hideSelects(this.zIndexNow);
	};
	this.cleanLoading = function () {
		if (this.booleanLoading == true) {
			this.booleanLoading = false;
			showSelects(this.zIndexNow);
			this.indexArr.pop();
			if (this.indexArr.length > 0){
				this.maskDiv.style.zIndex = this.indexArr[this.indexArr.length - 1];
				this.zIndexNow = this.indexArr[this.indexArr.length - 1] + 1;
			}
			else {
				document.body.removeChild(this.maskDiv);
				this.zIndexNow = 100;
			}
			if (opts == "1") {
				opts = "0";
				HelpTips.Init();
			}
		}
	};
};